package com.dialog.SimpleConfirmDialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.wifidoor.libview.R;


public class SimpleConfirmDialog extends Dialog implements View.OnClickListener {

    //��ʾ��
    private TextView mSlogan;
    //ȷ�ϰ�ť
    private Button mConfirm;

//    private MyCollectionActivity mActivity;
    private OnConfirmListener mListener;

    public SimpleConfirmDialog(Context context) {
        super(context, R.style.Theme_Light_FullScreenDialogAct);
        setContentView(R.layout.dialog_simple_confirm);

        initView();
        initData();
        initEvent();
    }

    @Override
    public void show() {
        super.show();
//        WindowManager m = mActivity.getWindowManager();
//        Display d = m.getDefaultDisplay(); // ��ȡ��Ļ������
//        WindowManager.LayoutParams p = getWindow().getAttributes(); // ��ȡ�Ի���ǰ�Ĳ���ֵ
//        p.height = 270;
//        p.width = 140;
//        getWindow().setAttributes(p);
    }

    /**
     * ��ʼ����ͼ
     */
    private void initView() {
        mSlogan = (TextView) findViewById(R.id.simple_dialog_slogan);
        //mCancel = (Button) findViewById(R.id.simple_dialog_cancel);
        mConfirm = (Button) findViewById(R.id.simple_dialog_confirm);
    }

    /**
     * ��ʼ���ؼ�������
     */
    private void initData() {

    }

    /**
     * ��ʼ���¼�
     */
    private void initEvent() {
        mConfirm.setOnClickListener(this);
    }

    public void setClickListener(String slogan, OnConfirmListener mListener) {
        mSlogan.setText(slogan);
        this.mListener = mListener;
    }

    @Override
    public void onClick(View view) {
    	
    	int ViewID = view.getId();
    	if(ViewID==R.id.simple_dialog_confirm) {
    		if(mListener!=null) mListener.onConfirm();
			cancel();	
    	}
    }

    public interface OnConfirmListener {
        void onConfirm();
    }
    
    public void setConfirmCorlor(int color){
    	mConfirm.setTextColor(color);
    }
}
